//
//  UILabel+UILabel.m
//  Goddess
//
//  Created by bigbang进哥哥 on 17/4/19.
//  Copyright © 2017年 bigbang进哥哥. All rights reserved.
//

#import "UILabel+UILabel.h"

@implementation UILabel (UILabel)

+ (UILabel *)createLabelText:(NSString *)text
                      textColor:(UIColor *)textColor
            textBackgroundColor:(UIColor *)textBackgroundColor
                      labelFont:(UIFont *)font
                  textAlignment:(NSTextAlignment)textAlignment
                  numberOfLines:(NSInteger)numberOfLines
{
    UILabel *label = [[UILabel alloc] init];
    label.text = text;
    label.textColor = textColor;
    label.backgroundColor = textBackgroundColor;
    label.font = font;
    label.textAlignment = textAlignment;
    label.numberOfLines = numberOfLines;
    return label;
}

+ (CGFloat)getHeightByWidth:(CGFloat)width title:(NSString *)title font:(UIFont *)font
{
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 0)];
    label.text = title;
    label.font = font;
    label.numberOfLines = 0;
    [label sizeToFit];
    CGFloat height = label.frame.size.height;
    return height;
}

+ (CGFloat)getWidthWithTitle:(NSString *)title font:(UIFont *)font {
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 1000, 0)];
    label.text = title;
    label.font = font;
    [label sizeToFit];
    return label.frame.size.width;
}

@end
